import QtQuick 1.1
import org.kde.plasma.components 0.1 as PlasmaComponents

Content {
    id: labelContent
    
    property alias alignment: labelItem.horizontalAlignment
    property alias label: labelItem.text
    
    minimumWidth: theme.defaultFont.mSize.width*5
    minimumHeight: theme.defaultFont.mSize.height
    desiredWidth: labelItem.implicitWidth
    desiredHeight: labelItem.implicitHeight
    
    PlasmaComponents.Label {
        id: labelItem
        
        property alias rotation: labelRotation.angle
        
        wrapMode: Text.Wrap
        elide: Text.ElideRight
        verticalAlignment: Text.AlignVCenter
        smooth: true
        maximumLineCount: height / labelContent.minimumHeight
        
        width: parent.width
        height: parent.height
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        
        transform: Rotation {
            id: labelRotation
            
            origin.x: labelContent.width/2
            origin.y: labelContent.height/2
            angle: 0
        }
        
        states: [
        State {
            name: "VERTICAL"
            when: taskContent.orientation=="RIGHT"||taskContent.orientation=="LEFT"
            
            PropertyChanges {
                target: labelContent
                
                width: parent.height
                height: parent.width
                rotation: (taskContent.orientation=="RIGHT")? 90 : -90
            }
        }
        ]
        
        // TODO: transitions
    }
}